PdfViewer for WinRT > PdfViewer Features > Loading Documents |
To open an existing PDF file you can use the LoadDocument or LoadDocumentAsync method by passing a stream to the file. To open a file selected by the user, complete the following code:
C# |
Copy Code
|
---|---|
FileOpenPicker openPicker = new FileOpenPicker(); openPicker.FileTypeFilter.Add(".pdf"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { Stream stream = await file.OpenStreamForReadAsync(); pdfViewer.LoadDocument(stream); } |